﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WinBot
{
    public partial class AddForm : Form
    {
        public static WinEvent ev;
        public static double delta = 0;

        public AddForm()
        {
            InitializeComponent();
            EventsForm.Form_MouseMove.FormClose += new EventHandler(Form_MouseMove_Closing);
            EventsForm.Form_MousePressed.FormClose += new EventHandler(Form_MousePressed_Closing);
            EventsForm.Form_MouseReleased.FormClose += new EventHandler(Form_MouseReleased_Closing);
            EventsForm.Form_KeyboardPressed.FormClose += new EventHandler(Form_KeyboardPressed_Closing);
            EventsForm.Form_KeyboardReleased.FormClose += new EventHandler(Form_KeyboardReleased_Closing);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {
                case 0:
                    {
                        EventsForm.Form_MouseMove mm = new EventsForm.Form_MouseMove();
                        mm.Show();
                        mm.Location = new Point(this.Location.X + 32, this.Location.Y + 64);
                        break;
                    }
                case 1:
                    {
                        EventsForm.Form_MousePressed mm = new EventsForm.Form_MousePressed();
                        mm.Show();
                        mm.Location = new Point(this.Location.X + 32, this.Location.Y + 64);
                        break;
                    }
                case 2:
                    {
                        EventsForm.Form_MouseReleased mm = new EventsForm.Form_MouseReleased();
                        mm.Show();
                        mm.Location = new Point(this.Location.X + 32, this.Location.Y + 64);
                        
                        break;
                    }
                case 3:
                    {
                        EventsForm.Form_KeyboardPressed mm = new EventsForm.Form_KeyboardPressed();
                        mm.Show();
                        mm.Location = new Point(this.Location.X + 32, this.Location.Y + 64);
                        break;
                    }
                case 4:
                    {
                        EventsForm.Form_KeyboardReleased mm = new EventsForm.Form_KeyboardReleased();
                        mm.Show();
                        mm.Location = new Point(this.Location.X + 32, this.Location.Y + 64);
                        break;
                    }
            }
        }

        private void Form_MouseMove_Closing(object sender, EventArgs e)
        {
            ev = EventsForm.Form_MouseMove.ev;
            textBox1.Text = "MMove: " + ev.MouseArgs.Location.ToString();
        }
        private void Form_MousePressed_Closing(object sender, EventArgs e)
        {
            ev = EventsForm.Form_MousePressed.ev;
            textBox1.Text = "MPClick: " + ev.MouseArgs.Button.ToString();
        }
        private void Form_MouseReleased_Closing(object sender, EventArgs e)
        {
            ev = EventsForm.Form_MouseReleased.ev;
            textBox1.Text = "MRClick: " + ev.MouseArgs.Button.ToString();
        }
        private void Form_KeyboardPressed_Closing(object sender, EventArgs e)
        {
            ev = EventsForm.Form_KeyboardPressed.ev;
            textBox1.Text = "KPKey: " + ev.KeyboardArgs.KeyCode;
        }
        private void Form_KeyboardReleased_Closing(object sender, EventArgs e)
        {
            ev = EventsForm.Form_KeyboardReleased.ev;
            textBox1.Text = "KRKey: " + ev.KeyboardArgs.KeyCode;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ev.Delta = (double) numericUpDown1.Value;
            FormClose(null, new EventArgs());
            this.Close();
        }

        public static event EventHandler FormClose = delegate { };
    }
}
